package com.gzhryc.shared_device.oem.code.member.dao.db;

import com.gzhryc.jdbc.annotaion.*;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * 会员的收货地址
 * @version 2022-01-30
 */
@NumberBranchTable(keyFieldName = "memberId")
@Table(name = "member_address")
public class MemberAddress implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @Column
    protected Long id;

    @Column(name="member_id",notNull = true,note = "会员ID")
    protected Long memberId;

    @Column(name = "receive_name",notNull = true,note=" 接收者姓名")
    protected String receiveName;

    @Column(name = "receive_phone",notNull = true,note = "接收者电话")
    protected String receivePhone;

    @Column
    protected String province;

    @Column
    protected String city;

    @Column(name = "city_area")
    protected String cityArea;

    @Column(name = "area_code", length = 128, note = "地区ID，以逗号分隔")
    protected String areaCode;

    @Column(length = 1024)
    protected String address;

    @Column(name = "state")
    protected Integer state;

    @Column(name = "update_date", autoUpdateTime = true)
    protected Date updateDate;

    @Column(name = "create_date")
    protected Date createDate;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getMemberId() {
        return memberId;
    }

    public void setMemberId(Long memberId) {
        this.memberId = memberId;
    }

    public String getReceiveName() {
        return receiveName;
    }

    public void setReceiveName(String receiveName) {
        this.receiveName = receiveName;
    }

    public String getReceivePhone() {
        return receivePhone;
    }

    public void setReceivePhone(String receivePhone) {
        this.receivePhone = receivePhone;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getCityArea() {
        return cityArea;
    }

    public void setCityArea(String cityArea) {
        this.cityArea = cityArea;
    }

    public String getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date updateDate) {
        this.updateDate = updateDate;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public String getFullAddress() {
        String str = "";
        if (StringUtils.isNotBlank(this.province)) {
            if (StringUtils.isNotBlank(this.city)) {
                str = this.province + this.city;
            } else {
                str = this.province;
            }
        } else if (StringUtils.isNotBlank(this.city)) {
            str = this.city;
        }
        return str + this.address;
    }
}
